package org.droidcon.apps.splashscreen;

import org.droidcon.apps.tunis2012.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class SplashScreenActivity1 extends Activity {
    private static final int STOPSPLASH = 0;
    private static final long SPLASHTIME = 2000;

    private Handler splashHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case STOPSPLASH:
                    //remove SplashScreen from view
                	// Create an intent that will start the main activity. *
                	Intent intent = new Intent(SplashScreenActivity1.this, SplashScreenActivity2.class);
                	
                	SplashScreenActivity1.this.startActivity(intent);
                    //terminer la splash screen pour quelle se termine
                    /* Finish splash activity so user cant go back to it. */
                    SplashScreenActivity1.this.finish();
                           
                    /* Apply our splash exit (fade out) and main
                       entry (fade in) animation transitions. */
                    overridePendingTransition(R.anim.mainfadein, R.anim.splashfadeout);
                    break;
            }
            super.handleMessage(msg);
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen1);
        //setContentView(R.layout.main);
        Message msg = new Message();
        msg.what = STOPSPLASH;
        splashHandler.sendMessageDelayed(msg, SPLASHTIME);
    }
}